let express = require('express');
let app = express();
let router = express.Router();

// simple logger for this router's requests
// all requests to this router will first hit this middleware
router.use(function(req, res, next) {
    console.log('%s %s %s', req.method, req.url, req.path);
    next();
});





var autoReplayController = require('../controllers/AutoReplyController');
var oauthController = require('../controllers/OauthController');
var cinemaMenuController = require('../controllers/CinemaMenuController');
var memberController = require('../controllers/MemberController');

//验签用Controller
var signatureController = require('../controllers/SignatureController');

//scan Controller
var scanController = require('../controllers/ScanController');

var cinemaDetailController = require('../controllers/CinemaDetailController');
var locationController = require('../controllers/LocationController');
var movielibController = require('../controllers/MovielibController');
var movieDetailController = require('../controllers/MovieDetailController');
var cityInfoController = require('../controllers/CityInfoController');


var loginController = require('../controllers/LoginController');

var cinemaCollectionController = require('../controllers/CinemaCollectionController');

var cinemaFootPrintController = require('../controllers/FootPrintCinemaController');
var movieFootPrintController = require('../controllers/FootPrintMovieController');

var movieCollectionController = require('../controllers/MovieCollectionController');

var movieSearchController = require('../controllers/MovieSearchController');

var shareController = require('../controllers/ShareController');
var liveController = require('../controllers/LiveContentController');


var accessTokenController = require('../controllers/AccessTokenController');
var commentController = require('../controllers/CommentController');
var spreadController = require('../controllers/SpreadController')


//微信自动回复
router.post('/weixin/api/auth/ack', autoReplayController.reply);
//验证消息的确来自微信服务器
router.get('/weixin/api/auth/ack', signatureController.signatureWeixin);

//测试oauth base
router.get('/oauth', oauthController.getOauth);

//测试oauth userinfo
router.get('/userinfo', oauthController.getUserInfo);

//微信绑定影厅扫码页面
router.get('/scan', scanController.setConfig);
//微信绑定影厅扫码页面，验证以及自动发送推送消息
router.post('/scanauth', scanController.sendTextMsg);
//微信公众号打开影吧
router.get('/cinemalist',cinemaMenuController.getCinema);
router.get('/cinema',cinemaMenuController.getCinemaHome);
router.post('/cinemainfo',cinemaMenuController.getCinemaInfo);
router.post('/getCityByPostion',cityInfoController.getCityByPostion);
router.post('/getCityByIP',cityInfoController.getCityByIP);
router.get('/cinemadetail',cinemaDetailController.getCinemaDetail);

router.get('/location',locationController.getLocation);

//影吧片库
router.get('/movielib',movielibController.getMovielib);

router.post('/movielib',movielibController.getMovieLibInfo);
router.post('/moviefilter',movielibController.postMovieFilter);
router.post('/movielibbyparam',movielibController.postMovieLibInfoByParam);
//影片详情
router.get('/moviedetail',movieDetailController.getMovieDetailModel);





//会员主页
router.get('/memberhome',memberController.getMemberHome);
//进入会员界面
router.get('/member',memberController.getMember);

//修改电话号码
router.get('/changephone',memberController.getChangePhone);
router.post('/getchangemobile',loginController.changePhone);


//图片验证码
router.get('/identifyingcode',loginController.getCode);
// 登录短信验证码
router.post('/loginsms',loginController.getSMS);
// 确认登录
router.post('/loginConfirm',loginController.loginConfirm);
// 会员卡信息
router.get('/memberCard', loginController.getCard);

//更换用户
router.post('/changeuser', loginController.changeUser);

router.get('/getchangeuser', memberController.getchangeUser);
//更改影吧收藏状态
router.post('/updatecinemacollection',cinemaCollectionController.updateCinemaCollection);
//更改影片收藏状态
router.post('/updatemoviecollection',movieCollectionController.updateMovieCollection);

//收藏影吧界面
router.get('/collectioncinema',cinemaCollectionController.getCollectionCinema);
//收藏影片界面
router.get('/collectionmovie',movieCollectionController.getCollectionMovie);


router.get('/footprintcinema',cinemaFootPrintController.getFootPrintCinema);
router.get('/footprintmovie',movieFootPrintController.getFootPrintMovie);

router.post('/collectioncinemainfo',cinemaCollectionController.getCollectionCinemaInfo);
router.post('/collectionmovieinfo',movieCollectionController.getCollectionMovieInfo);

router.post('/footprintcinemainfo',cinemaFootPrintController.getFootPrintCinemaInfo);
router.post('/footprintmovieinfo',movieFootPrintController.getFootPrintMovieInfo);

// 影片查询部分    影片查询首页
router.get('/filmpage',movieSearchController.showMovieSearch);
// 最新电影
// router.get('/getnewfilm',movieSearchController.getNewFilm);
// 最热电影
// router.get('/gethotfilm',movieSearchController.getHotFilm);
// 评分电影
// router.get('/getscorefilm',movieSearchController.getScoreFilm);

//router.get('/pageHome',movieSearchController.getPageHome);
router.get('/moviesearch',movieSearchController.getmoviesearch);
router.get('/getpagedata',movieSearchController.getPageData);
router.get('/cinemapage',movieSearchController.showCinemas);
router.get('/showmovielib',movieSearchController.showMovieLib);

//影片库
router.get('/moviesearchlib',movieSearchController.getMoviesearchlib);

router.post('/moviesearchlib',movieSearchController.getMoviesearchLibInfo);
// router.post('/moviesearchfilter',movieSearchController.postMoviesearchFilter);
// router.post('/moviesearchlibbyparam',movieSearchController.postMoviesearchLibInfoByParam);
router.get('/moviesearchdetail',movieSearchController.getMovieSearchDetail);
router.get('/movielibparam',movieSearchController.showMovieLibByParams);

router.get('/sharemoviedetail',shareController.getMovie);
router.get('/sharecinemadetail',shareController.getCinema);


router.get('/getlivecontent',liveController.getLiveContentData);
router.get('/getlivecategory',liveController.getLiveCategory);
router.get('/getlivecontentbytype',liveController.getLiveContentDataByType);
router.post('/getaccesstoken',accessTokenController.getAccessTokenBySign);

// router.get('/index',reactController.getIndex)
router.post('/postcommentlist',commentController.postCommentList)
router.post('/postCommentListByPage',commentController.postCommentListByPage)
router.post('/postcomment',commentController.postComment)
router.get('/newcomment',commentController.getNewComment)
router.get('/morecomment',commentController.getMoreComment)
router.post('/postaddcomment',commentController.postaddcomment)
router.post('/postCommentAgree',commentController.postCommentAgree)
router.get('/replycomment',commentController.getreplycomment)
router.post('/postreplycomment',commentController.postreplycomment)

router.get('/spreaderview',spreadController.getView);

router.get('/spreader',spreadController.getSpreaderView);

router.post('/getSpreaders',spreadController.getSpreader);

/**
 *
 * add by yan
 * 影院主页
 * 加入可预约的房间类型列表
 */
//router.get('/cinema',require('../controllers/WXBookingController').showCinema);
router.post('/getcinemaroomtypes',require('../controllers/WXBookingController').getCinemaRoomTypes);
router.get('/cinemaroomtype',require('../controllers/WXBookingController').showCinemaRoomType);
router.post('/submitbooking',require('../controllers/WXBookingController').submitBooking);
/**
 *  * add by yan
 * 预约订单
 */
router.get('/bookingorders',require('../controllers/WXBookingController').showBookingOrders);
router.post('/getbookingorders',require('../controllers/WXBookingController').getBookingOrders);
router.post('/cancelbooking',require('../controllers/WXBookingController').cancelBooking);

/**
 * 改版v2.0-dev
 *  * add by yan
 * WX公众号改版（影片首页）
 * 2017-08-03
 */
router.get('/recommendedmovies',require('../controllers/WXMoviesController').showRecommendedMovies);
router.post('/getrecommendedmovies',require('../controllers/WXMoviesController').getRecommendedMovies);
/**
 * 改版v2.0-dev
 *  * add by yan
 * WX公众号改版（影片列表页）
 * 搜索后/专辑/筛选后
 * 2017-08-15
 */
router.get('/filtedmovies',require('../controllers/WXMoviesController').showFiltedMovies);
router.post('/getfiltedmovies',require('../controllers/WXMoviesController').getFiltedMovies);
router.post('/getsearchedmovies',require('../controllers/WXMoviesController').getSearchedMovies);
/**
 * 改版v2.0-dev
 *  * add by yan
 * WX公众号改版（影片详情页）
 * 2017-08-15
 */
router.get('/moviehome',require('../controllers/WXMoviesController').showMovieHome);
router.post('/getcinemasbymid',require('../controllers/WXMoviesController').getCinemasByMid);

/**
 * 改版v2.0-dev
 *  * add by yan
 * WX公众号改版（影院首页）
 * 2017-08-19
 */
router.get('/recommendedcinemas',require('../controllers/WXCinemasController').showRecommendedCinemas);
router.post('/getrecommendedcinemas',require('../controllers/WXCinemasController').getRecommendedCinemas);
router.post('/getsearchedcinemas',require('../controllers/WXCinemasController').getSearchedCinemas);

router.get('/cityhome',require('../controllers/WXCinemasController').showCityHome);
router.post('/getcitybycode',require('../controllers/WXCinemasController').getCityByCode);
router.post('/getcitybylatlng',require('../controllers/WXCinemasController').getCityByLatLng);
router.post('/getregionoptions',require('../controllers/WXCinemasController').getRegionOptions);

/**
 * 改版v2.0-dev
 *  * add by yan
 * WX公众号改版（影院详情页）
 * 2017-09-29
 */
router.get('/cinemahome',require('../controllers/WXCinemasController').showCinemaHome);
//router.post('/getmoviesbycinemacode',require('../controllers/WXCinemasController').getMoviesByCinemaCode);

/**
 * 改版v2.0-dev
 *  * add by yan
 * WX公众号改版（收藏）
 * 2017-09-29
 */
router.post('/setcollection',require('../controllers/WXCollectionController').setCollection);


/**
 * 改版v2.0-dev
 *  * add by yan
 * WX公众号改版（用户中心）
 * 2017-09-29
 */
router.get('/usercenter',require('../controllers/WXUserCenterController').showUserCenter);
router.get('/collectionhome',require('../controllers/WXCollectionController').showCollection);
router.post('/getcollectionlist',require('../controllers/WXCollectionController').getCollection);

router.get('/footprinthome',require('../controllers/WXFootprintController').showFootprint);
router.post('/getfootprintlist',require('../controllers/WXFootprintController').getFootprint);

/**
 * 用户注册-绑定
 */
router.get('/activation',require('../controllers/WXActivationController').showActivation);
router.get('/regist',require('../controllers/WXActivationController').showRegister);

router.get('/graphiccode',require('../controllers/WXActivationController').getGraphicCode);
router.post('/wxidentifyingcode',require('../controllers/WXActivationController').getIdentifyingCode);
router.post('/activation',require('../controllers/WXActivationController').activation);
router.get('/activationSuccess',require('../controllers/WXActivationController').activationSuccess);


/**
 * 实体卡绑定
 *  * add by yan
 * WX公众号改版（实体卡绑定）
 * 2017-09-29
 */
router.get('/cardbinding',require('../controllers/WXCardsController').showCardBinding);
router.post('/setcardbinding',require('../controllers/WXCardsController').setCardBinding);
router.get('/cardpackage',require('../controllers/WXCardsController').showCardPackage);

/**
 * 版权商
 *  * add by yan
 * WX公众号改版（版权商）
 * 2017-09-29
 */
router.get('/copyright',require('../controllers/WXCopyrightController').showCopyright);

module.exports = router;
